Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. applyBillingAddress: function () {
  2. var shippingAddress;
  3.  
  4. if (quote.billingAddress()) {
  5. selectBillingAddress(quote.billingAddress());
  6.  
  7. return;
  8. }
  9. shippingAddress = quote.shippingAddress();
  10.  
  11. if (shippingAddress &&
  12. shippingAddress.canUseForBilling() &&
  13. (shippingAddress.isDefaultShipping() || !quote.isVirtual())
  14. ) {
  15. if(quote.shippingMethod()['method_code']=='store pick_up code'){
  16. //uncheck here
  17. }else{
  18. //check here
  19. selectBillingAddress(quote.shippingAddress());
  20. }
  21. }
  22. }
  23.  
  24. saveShippingInformation: function () {
  25. var payload;
  26.  
  27. if (!quote.billingAddress()) {
  28. if(quote.shippingMethod()['method_code']=='store pick_up code'){
  29. //uncheck here
  30. }else{
  31. //check here
  32. selectBillingAddress(quote.shippingAddress());
  33. }
  34. }
  35.  
  36. payload = {
  37. addressInformation: {
  38. 'shipping_address': quote.shippingAddress(),
  39. 'billing_address': quote.billingAddress(),
  40. 'shipping_method_code': quote.shippingMethod()['method_code'],
  41. 'shipping_carrier_code': quote.shippingMethod()['carrier_code']
  42. }
  43. };
  44.  
  45. payloadExtender(payload);
  46.  
  47. fullScreenLoader.startLoader();
  48.  
  49. return storage.post(
  50. resourceUrlManager.getUrlForSetShippingInformation(quote),
  51. JSON.stringify(payload)
  52. ).done(
  53. function (response) {
  54. quote.setTotals(response.totals);
  55. paymentService.setPaymentMethods(methodConverter(response['payment_methods']));
  56. fullScreenLoader.stopLoader();
  57. }
  58. ).fail(
  59. function (response) {
  60. errorProcessor.process(response);
  61. fullScreenLoader.stopLoader();
  62. }
  63. );
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement