Skip to content

Commit

Permalink
Dev3.6.1 (#57)
Browse files Browse the repository at this point in the history
* Order ID

Update checkout ID with order ID on charge

* correct qty

* idev onestep

* Additional Countries

* update orderID

* item image url

* remove duplicate block

* I dev onestep checkout (#58)

* onload fix

* fix onload

* version bump

* version bump
  • Loading branch information
kkong87 authored and nandadubey committed Mar 4, 2019
1 parent 119bdd8 commit 23c0ba2
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:

package: validate_version
mkdir -p ./var/
cd ./extension && tar -cvf ../var/Affirm_Affirm-3.6.0.tgz *
cd ./extension && tar -cvf ../var/Affirm_Affirm-3.6.1.tgz *
cd ./build && ./magento-tar-to-connect.phar affirm_tar_to_connect_config.php

clean:
Expand Down
6 changes: 3 additions & 3 deletions build/affirm_tar_to_connect_config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
return array(
'base_dir' => realpath('../var/'),
'archive_files' => 'Affirm_Affirm-3.6.0.tgz',
'archive_files' => 'Affirm_Affirm-3.6.1.tgz',
'extension_name' => 'Affirm_Magento',
'skip_version_compare' => true,
'extension_version' => '3.6.0',
'archive_connect' => 'Affirm_Affirm-3.6.0.tgz',
'archive_connect' => 'Affirm_Affirm-3.6.1.tgz',
'path_output' => realpath('../var/'),

'stability' => 'stable',
Expand All @@ -19,5 +19,5 @@
'author_user' => 'affirm',
'author_email' => '[email protected]',
'php_min' => '5.2.0',
'php_max' => '7.2.0',
'php_max' => '7.2.14',
);
9 changes: 5 additions & 4 deletions extension/app/code/community/Affirm/Affirm/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,15 @@ public function authorize(Varien_Object $payment, $amount)
$amountToAuthorize = $this->_getCheckoutTotalFromToken($token);
$this->_validateAmountResult($amountCents, $amountToAuthorize);
$order = $payment->getOrder();
$orderId = $order->getIncrementId();
if($order) {
$storeId = $order->getStoreId();
}
if (!$storeId) {
$storeId = null;
}
$result = $this->_apiRequest(Varien_Http_Client::POST, '', array(
self::CHECKOUT_TOKEN => $token), $storeId
self::CHECKOUT_TOKEN => $token,'order_id' =>$orderId), $storeId
);

$this->_setChargeResult($result);
Expand Down Expand Up @@ -558,7 +559,7 @@ public function getCheckoutObject($order)
'sku' => $orderItem->getSku(),
'display_name' => $orderItem->getName(),
'item_url' => $product->getProductUrl(),
'item_image_url' => $product->getImageUrl(),
'item_image_url' => Mage::getModel('catalog/product')->load($orderItem->getProductId())->getImageUrl(),
'qty' => intval($orderItem->getQtyOrdered()),
'unit_price' => Mage::helper('affirm/util')->formatCents($orderItem->getPrice())
);
Expand Down Expand Up @@ -708,8 +709,8 @@ public function getCheckoutQuoteObject($quote)
'sku' => $orderItem->getSku(),
'display_name' => $orderItem->getName(),
'item_url' => $product->getProductUrl(),
'item_image_url' => $product->getImageUrl(),
'qty' => intval($orderItem->getQtyOrdered()),
'item_image_url' => Mage::getModel('catalog/product')->load($orderItem->getProductId())->getImageUrl(),
'qty' => intval($orderItem->getQty()),
'unit_price' => Mage::helper('affirm/util')->formatCents($orderItem->getPrice())
);

Expand Down
4 changes: 2 additions & 2 deletions extension/app/code/community/Affirm/Affirm/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<config>
<modules>
<Affirm_Affirm>
<version>3.6.0</version>
<version>3.6.1</version>
</Affirm_Affirm>
</modules>
<global>
Expand Down Expand Up @@ -366,7 +366,7 @@
<disable_for_backordered_items>0</disable_for_backordered_items>
<plain_text_title_enabled>0</plain_text_title_enabled>
<allowspecific>1</allowspecific>
<specificcountry>US</specificcountry>
<specificcountry>US,PR,GU,MP,VI,AS</specificcountry>
<notification_feed>https://github.com/Affirm/Magento_Affirm/releases.atom</notification_feed>
<notification_check_frequency>86400</notification_check_frequency>
<notification_update>1</notification_update>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,30 @@ if (Mage::helper('affirm')->isCheckoutFlowTypeModal()) {
}
/* End - For GoMage Checkout */

/* Start - For iDev One Step Checkout*/
function calliDevCheckoutForAffirm () {
var form = new VarienForm('onestepcheckout-form');
if(form.validator.validate()){

jQuery('.onestepcheckout-place-order-wrapper').append('<div class="loading-ajax"></div>')
var formData = Form.serialize($('onestepcheckout-form'), true);

new Ajax.Request('<?php echo Mage::helper("affirm")->getOPCCheckoutUrl();?>', {
method: 'post',
parameters: formData,
onSuccess: function (transport) {
callAffirmModalCheckout(formData);
hideLoading();
},
on403: function () {
document.location.reload();
}
}
);
}
}
/* End - For iDev One Step Checkout*/

//]]>
</script>
<?php
Expand Down
16 changes: 10 additions & 6 deletions extension/package.xml

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions extension/skin/frontend/base/default/js/affirm/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,41 @@ document.observe('dom:loaded', function () {
);
}
}

// This is for iDev One Page Checkout
if ($('onestepcheckout-form')) {
if ($('onestepcheckout-place-order')) {
jQuery('.onestepcheckout-place-order-wrapper').append('<img id="affirmCheckout" style="display: none" onclick ="calliDevCheckoutForAffirm()" src ="https://cdn-assets.affirm.com/images/buttons/checkout/42x205-blue.png">')
if(jQuery('#p_method_affirm').is(':checked')){
jQuery('#onestepcheckout-place-order').hide()
jQuery('#affirmCheckout').css('display', 'inline')
}
$('onestepcheckout-form').on('change',function(){
if(jQuery('#p_method_affirm').is(':checked')){
jQuery('#onestepcheckout-place-order').hide()
jQuery('#affirmCheckout').css('display', 'inline')
}
jQuery('.payment-methods').change(function(){
if(jQuery('#p_method_affirm').is(':checked')){
jQuery('#onestepcheckout-place-order').hide()
jQuery('#affirmCheckout').css('display', 'inline')
} else {
jQuery('#onestepcheckout-place-order').show()
jQuery('#affirmCheckout').hide()
}
})
})
jQuery('.payment-methods').change(function(){
if(jQuery('#p_method_affirm').is(':checked')){
jQuery('#onestepcheckout-place-order').hide()
jQuery('#affirmCheckout').css('display', 'inline')
} else {
jQuery('#onestepcheckout-place-order').show()
jQuery('#affirmCheckout').hide()
}
})
}
}
});

window.addEventListener('load', function() {
Expand Down

0 comments on commit 23c0ba2

Please sign in to comment.